#pragma once

#include "../base_outputer.h"
#include "IVEF/ilistenapplication.h"
#include "common/timeout_manager.hpp"

enum IVEF_LOGIN_ERROR
{
    NET_CONNECT_ERROR,
    USER_LOGIN_ERROR
};

typedef std::function<void(int, const std::string&)> ivefLoginErrorCb;

class OutputerIvef : public BaseOutputer
{
public:
    OutputerIvef();
    ~OutputerIvef();

    virtual void Login(const char*value);
    virtual void UpdateRadarPoint(CCVBlockInfo *message);
    virtual void UpdateRadarInfo(const radar_info* info);

    void Response(const ivef::LoginResponse&);
    void LoginNetError(const std::string&);

    void SetIvefLoginErrorCb(ivefLoginErrorCb cb);

    void LoginTimeout();
private:
    iListenApplication m_ivef_app;

    bool m_is_connected;

    ivefLoginErrorCb m_ivef_loginerror_cb;

    TimeOutManager m_timeout_manager;

    ivef::ObjectDatas m_track_datas;
    ivef::ObjectDatas m_plot_datas;
};